Skip to content

Adapt multitaper power spectrum engines to changing window lengths - #1055

Merged
wangyinz merged 1 commit into
masterfrom
codex/fix-1044-spectrum-resize
Oct 23, 2026
Merged

wangyinz merged 1 commit into
masterfrom
codex/fix-1044-spectrum-resize

Conversation

@wangyinz

@wangyinz wangyinz commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Reusing the Prieto MTPowerSpectrumEngine with a slightly different window length raised ValueError and could make broadband_snr_QC discard otherwise valid data. Resize the operator and rebuild its length-specific tapers, retaining a sufficiently large explicit FFT size or selecting an automatic size when necessary. Failed numerical construction preserves the previous cached state.

Regression coverage checks all three input types, repeated length changes against freshly constructed engines, FFT sizing, invalid inputs, and broadband SNR using the existing waveform fixture. Native tests verify that the C++ TimeSeries overload pads/truncates while its vector overload remains strict.

Validation: 24 targeted tests passed with the real Prieto numerical backend. Black 25.1.0 and static syntax checks passed. GitHub Actions rebuilt the current native code and passed the complete test suite on Python 3.10 and 3.13, including the native-length behavior and broadband SNR regressions. CMake, Docker, formatting, static, and dependency checks also passed.

Fixes #1044.

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.28%. Comparing base (ecfed17) to head (db34f1b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1055      +/-   ##
==========================================
+ Coverage   75.19%   75.28%   +0.08%     
==========================================
  Files         185      185              
  Lines       38176    38185       +9     
  Branches     2587     2587              
==========================================
+ Hits        28706    28746      +40     
+ Misses       8544     8516      -28     
+ Partials      926      923       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wangyinz
wangyinz requested a review from pavlis October 22, 2026 15:39

@pavlis pavlis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a pretty straightforward fix. The new tests it adds indicate it solves the problem.

@wangyinz
wangyinz merged commit 7cf6bcc into master Oct 23, 2026
23 checks passed
@wangyinz
wangyinz deleted the codex/fix-1044-spectrum-resize branch October 23, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

frequency domain snr estimators are not as robust as they should be

2 participants